package com.huangsm.book.designmodel.reference;

import com.sun.javafx.util.WeakReferenceQueue;

import java.lang.ref.ReferenceQueue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;

/**
 * @author huang
 * @PACKAGE_NAME com.huangsm.book.designmodel.reference
 * @PROJECT_NAME concurrence
 * @date 2019/2/18
 */
public class WeakHashMapDemo {
    public static void main(String[] args) {
        WeakHashMap map = new WeakHashMap();
        //Map map=new HashMap();
        ArrayList list = new ArrayList();
        for (int i = 0; i <100000; i++) {
            Integer integer = new Integer(i);
            list.add(integer);//强引用key
            map.put(integer,new byte[i]);
        }
    }
}
